﻿using System;
using System.Collections.Generic;
using System.IO;
using Calimbra.Addin.Functions;
using Calimbra.Addin.Messages;

namespace Calimbra.Addin.Boards
{
    public class Extract_function_units
    {
        private readonly Action<FileInfo> process;
        public Action<List<FunctionUnit>> Result;

        public Extract_function_units(Read_rows read_row, Identify_function_units identify_function_units)
        {
            process = read_row.Process;
            read_row.NextRow += identify_function_units.Check;
            identify_function_units.Result += r => Result(r);
            read_row.EOF += identify_function_units.FireStatus;
        }

        public void Process(FileInfo fdf_file)
        {
            process(fdf_file);
        }
    }
}